﻿#ifndef IMAGEVIEWWIDGET_H
#define IMAGEVIEWWIDGET_H

#include <QMovie>
#include <QWidget>

namespace Ui {
class ImageViewWidget;
}

class ImageViewWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ImageViewWidget(QWidget *parent = nullptr);
    ~ImageViewWidget();

    void setFilePath(QString filePath);

    QImage image() const;
    void setImage(const QImage &newImage);

signals:
    void onHiddend();


private:
    Ui::ImageViewWidget *ui;

    bool m_movieing;
    QMovie m_movie;
    QImage m_image;

    // QWidget interface
protected:
    void dragEnterEvent(QDragEnterEvent *event);
    void dropEvent(QDropEvent *event);


private slots:
    void on_actionClose_triggered();
    void on_label_customContextMenuRequested(const QPoint &pos);

    // QWidget interface
protected:
    void resizeEvent(QResizeEvent *event);
};

#endif // IMAGEVIEWWIDGET_H
